package com.spring.sunflower.common;

import com.spring.sunflower.base.BaseObserver;
import com.spring.sunflower.base.BasePresenter;
import com.spring.sunflower.bean.CommonBean;
import com.spring.sunflower.bean.STSCertBean;

import io.reactivex.rxjava3.core.Observable;

/**
 * Created by Kevin on 2021/6/24<br/>
 * <p>
 * Describe:<br/>
 */
public class ReportPresenter extends BasePresenter<CommonContract.ReportView> {
    public ReportPresenter(CommonContract.ReportView baseView) {
        super(baseView);
    }

    public void report(String reportMemberId, String type, String reason, String operatorMobile) {
        Observable<CommonBean> observable = requestDataSource.requestReport(reportMemberId, type, reason, operatorMobile);
        addDisposable(observable, new BaseObserver<CommonBean>(baseView) {

            @Override
            public void onSuccess(CommonBean bean) {
                baseView.reportSuccess();
            }

            @Override
            public void onError(int status, String msg) {

            }
        });

    }

    public void getSTSCert() {
        Observable<STSCertBean> observable = requestDataSource.getSTSCert();
        addDisposable(observable, new BaseObserver<STSCertBean>(baseView) {

            @Override
            public void onSuccess(STSCertBean bean) {
                STSCertBean.DatasBean datas = bean.getDatas();
                baseView.loadSTSCert(datas);
            }

            @Override
            public void onError(int status, String msg) {

            }
        });
    }
}
